home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
jaz_clib.arc
/
DOSREADS.ASM
< prev
next >
Wrap
Assembly Source File
|
1989-04-09
|
1KB
|
45 lines
Comment *
┌────────────────────────────────────────────────────────────────────────────┐
│Dosreads.asm │
│Allows direct sector access from 'C' which is not possible using int86 │
│because this int leaves a word on the stack which would cause int86 to │
│return to some unknown place. │
│usage: │
│char wbuf[512]; ;at lease 512 bytes for sector buffer │
│int werror; │
│ │
│werror = dosreads(0,0,1,wbuf); ; reads drive 'A',sector 0, 1 sector into │
│ ; wbuf. │
│ │
│ │
│ (C) JazSoft Software by Jack A. Zucker (301) 794-5950 │
└────────────────────────────────────────────────────────────────────────────┘
*
assume cs:_text
_text segment public byte 'code'
public _dosreads
_dosreads proc near
push bp
mov bp,sp
push si ; save user's "C" register variables
push di
mov al,[bp+4] ; drive number
mov dx,[bp+6] ; which sector to read
mov cx,[bp+8] ; amount of sectors
mov bx,[bp+0Ah] ; offset of buffer
int 25h
jc _dosreadserror ; if carry then error occurred
mov ax,0 ; else return a zero
_dosreadserror:
popf ; int 25h pushes flags
pop di ; restore user's "C" register variables
pop si
pop bp ; restore base pointer
ret
_dosreads endp
_text ends
end